<template>
  <div id="qr">
    <div id="code"/>
    <canvas id="canvas"/>
    <img 
      id="img" 
      src="">
  </div>
</template>
<script>
import Vue from 'vue'
import QRCode from 'qrcode'

Vue.use(QRCode)
export default {
  data() {
    return {
      codes: '99999999'
    }
  },
  mounted() {
    this.useqrcode()
  },
  methods: {
    useqrcode() {
      const canvas = document.getElementById('canvas')
      QRCode.toCanvas(canvas, 'http://www.baidu.com', error => {
        if (error) console.error(error)
        console.log('success!')
      })
    },
    user() {
      console.log('ooooo')
    }
  }
}
</script>
<style>
</style>
